﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class lxse : System.Web.UI.UserControl
{
    public string HtmlTableStr = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["username"] != null)
        {
            AspNetPager1.RecordCount = SQL.ExecScalar("select count(*) from wtmark where markm like '%练习%' and stunumber='" + Session["username"].ToString() + "'");
            if (AspNetPager1.RecordCount == 0)
            {
                //空数据页面美化
                HtmlTableStr += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width: 700px;background-position: center center; background-attachment: scroll; background-image: url(image/maintit36.jpg);background-repeat: repeat;\">";
                HtmlTableStr += "<tr>";
                HtmlTableStr += "<td style=\"width: 100px;height:30px;\" class=\"topStyle\"><b>学号</b></td>";
                HtmlTableStr += "<td style=\"width: 100px;height:30px;\" class=\"tdStyle\"><b>考试科目</b></td>";
                HtmlTableStr += "<td style=\"width: 250px;height:30px;\" class=\"tdStyle\"><b>试卷编号</b></td>";
                HtmlTableStr += "<td style=\"width: 50px;height:30px;\" class=\"tdStyle\"><b>单选题</b></td>";
                HtmlTableStr += "<td style=\"width: 50px;height:30px;\" class=\"tdStyle\"><b>判断题</b></td>";
                HtmlTableStr += "<td style=\"width: 50px;height:30px;\" class=\"tdStyle\"><b>总成绩</b></td>";
                HtmlTableStr += "</tr>";
                HtmlTableStr += "</table>";

                HtmlTableStr += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width: 700px;\" bgcolor=\"#f0f0f0\">";
                //循环5次标示空数据单元
                for (int i = 1; i <= 5; i++)
                {
                    HtmlTableStr += "<tr>";
                    HtmlTableStr += "<td style=\"width: 100px;height:27px;\" class=\"ReptopStyle\">&nbsp;</td>";
                    HtmlTableStr += "<td style=\"width: 100px;height:27px;\" class=\"ReptdStyle\">&nbsp;</td>";
                    HtmlTableStr += "<td style=\"width: 250px;height:27px;\" class=\"ReptdStyle\">&nbsp;</td>";
                    HtmlTableStr += "<td style=\"width: 50px;height:27px;\" class=\"ReptdStyle\">&nbsp;</td>";
                    HtmlTableStr += "<td style=\"width: 50px;height:27px;\" class=\"ReptdStyle\">&nbsp;</td>";
                    HtmlTableStr += "<td style=\"width: 50px;height:27px;\" class=\"ReptdStyle\">&nbsp;</td>";
                    HtmlTableStr += "</tr>";
                }  
                HtmlTableStr += "</table>";
            }
            else
            {
                AspNetPager1.PageSize = 19;

                PageData.bindData(Repeater1, "select * from wtmark where markm like '%练习%' and stunumber='" + Session["username"].ToString() + "' order by pkID desc", "wtmark", AspNetPager1);
            }
        }
        else
        {
            JScript.AlertAndRedirect("信息检测，请重新登录！", "leks.aspx");
        }
    }
    protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
    {
        AspNetPager1.CurrentPageIndex = e.NewPageIndex;
        PageData.bindData(Repeater1, "select * from wtmark where markm like '%练习%' and stunumber='" + Session["username"].ToString() + "' order by pkID desc", "wtmark", AspNetPager1);
    }
}
